import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '@/layout'

/**
 * Note: sub-menu only appear when route children.length >= 1
 * Detail see: https://panjiachen.github.io/vue-element-admin-site/guide/essentials/router-and-nav.html
 *
 * hidden: true                   if set true, item will not show in the sidebar(default is false)
 * alwaysShow: true               if set true, will always show the root menu
 *                                if not set alwaysShow, when item has more than one children route,
 *                                it will becomes nested mode, otherwise not show the root menu
 * redirect: noRedirect           if set noRedirect will no redirect in the breadcrumb
 * name:'router-name'             the name is used by <keep-alive> (must set!!!)
 * meta : {
    roles: ['admin','editor']    control the page roles (you can set multiple roles)
    title: 'title'               the name show in sidebar and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar
    noCache: true                if set true, the page will no be cached(default is false)
    affix: true                  if set true, the tag will affix in the tags-view
    breadcrumb: false            if set false, the item will hidden in breadcrumb(default is true)
    activeMenu: '/example/list'  if set path, the sidebar will highlight the path you set
  }
 */

/**
 * constantRoutes
 * a base page that does not have permission requirements
 * all roles can be accessed
 */

export const constantRoutes = [
  // Home
  {
    path: '/',
    component: Layout,
    hidden: true,
    redirect: '/home',
    children: [
      {
        path: 'home',
        component: () => import('@/views1/home/index'),
        name: 'Home',
        meta: { title: '首页', icon: 'star', affix: true }
      }
    ]
  },

  // redirect
  {
    path: '/redirect',
    component: Layout,
    hidden: true,
    children: [
      {
        path: '/redirect/:path*',
        component: () => import('@/views/redirect/index')
      }
    ]
  },

  // login
  {
    path: '/login',
    component: () => import('@/views/login/index'),
    hidden: true
  },

  // auth-redirect
  {
    path: '/auth-redirect',
    component: () => import('@/views/login/auth-redirect'),
    hidden: true
  }

  // // 404
  // {
  //   path: '/404',
  //   component: () => import('@/views/error-page/404'),
  //   hidden: true
  // },

  // // 401
  // {
  //   path: '/401',
  //   component: () => import('@/views/error-page/401'),
  //   hidden: true
  // },

  // // documentation
  // {
  //   path: '/documentation',
  //   component: Layout,
  //   hidden: true,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/documentation/index'),
  //       name: 'Documentation',
  //       meta: { title: 'Documentation', icon: 'documentation' }
  //     }
  //   ]
  // },

  // // guide
  // {
  //   path: '/guide',
  //   component: Layout,
  //   hidden: true,
  //   redirect: '/guide/index',
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/guide/index'),
  //       name: 'Guide',
  //       meta: { title: 'Guide', icon: 'guide', noCache: true }
  //     }
  //   ]
  // },

  // // profile
  // {
  //   path: '/profile',
  //   component: Layout,
  //   redirect: '/profile/index',
  //   hidden: true,
  //   children: [
  //     {
  //       path: 'index',
  //       component: () => import('@/views/profile/index'),
  //       name: 'Profile',
  //       meta: { title: 'Profile', icon: 'user', noCache: true }
  //     }
  //   ]
  // }
]

/**
 * asyncRoutes
 * the routes that need to be dynamically loaded based on user roles
 */
export const asyncRoutes = [
  // {
  //   path: '/login2',
  //   component: () => import('@/views/login/index'),
  //   // hidden: true,
  //   name: 'login2',
  //   meta: {
  //     title: '登录 test',
  //     icon: 'lock',
  //     roles: ['admin', 'editor'] // you can set roles in root nav
  //   }
  // },

  // userInfo
  {
    path: '/userInfo',
    component: Layout,
    alwaysShow: false,
    children: []
  },

  // test
  {
    path: '/test',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'test',
    // hidden: true,
    meta: {
      title: '开发测试用',
      icon: 'peoples',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      // 测试工作流
      {
        path: 'test-workflow',
        component: () => import('@/views1/test/hr/test-workflow'),
        name: 'test-workflow',
        // hidden: true,
        meta: { title: '测试工作流', icon: 'dashboard' }
      },

      // res-partner
      {
        path: 'res',
        component: () => import('@/views1/home/space'),
        name: 'res',
        alwaysShow: true, // will always show the root menu
        meta: { title: 'RES', icon: 'dashboard' },
        children: [
          {
            path: 'res-partner',
            component: () => import('@/views1/test/res/res-partner'),
            name: 'res-partner',
            meta: { title: 'res.partner', icon: 'dashboard' }
          },
          {
            path: 'res-partner-detail',
            component: () => import('@/views1/test/res/res-partner-detail'),
            name: 'res-partner-detail',
            hidden: true,
            meta: { title: 'res.partner.detail', icon: 'dashboard' }
          }
        ]
      },

      // user and company
      {
        path: '/base',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'base',
        meta: {
          title: 'SaaS平台管理',
          icon: 'peoples',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },
        children: [
          {
            path: 'res-company',
            component: () => import('@/views1/test/res/res-company'),
            name: 'res-company',
            meta: { title: '公司', icon: 'dashboard' }
          },
          {
            path: 'res-company-detail',
            component: () => import('@/views1/test/res/res-company-detail'),
            name: 'res-company-detail',
            hidden: true,
            meta: { title: '公司-详情', icon: 'dashboard' }
          },
          {
            path: 'res-users',
            component: () => import('@/views1/test/res/res-users'),
            name: 'res-users',
            meta: { title: '平台用户', icon: 'dashboard' }
          },
          {
            path: 'res-users-detail',
            component: () => import('@/views1/test/res/res-users-detail'),
            name: 'res-users-detail',
            hidden: true,
            meta: { title: '用户-详情', icon: 'dashboard' }
          }
        ]
      },

      // crm
      {
        path: '/partner',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'partner',
        meta: {
          title: 'CRM',
          icon: 'peoples',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },
        children: [
          {
            path: 'res-partner-company',
            component: () => import('@/views1/test/res/res-partner-company'),
            name: 'res-partner-company',
            meta: { title: '客户信息', icon: 'dashboard' }
          },
          {
            path: 'res-partner-company-detail',
            component: () =>
              import('@/views1/test/res/res-partner-company-detail'),
            name: 'res-partner-company-detail',
            hidden: true,
            meta: { title: '客户信息-详情', icon: 'dashboard' }
          }
        ]
      },

      // sale
      {
        path: '/sale-root',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'sale-root',
        meta: {
          title: '销售管理',
          icon: 'dashboard',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },

        children: [
          {
            path: 'sale-order',
            component: () => import('@/views1/test/sale/sale-order'),
            name: 'sale-order',
            meta: { title: '销售订单', icon: 'dashboard' }
          },
          {
            path: 'sale-order-detail',
            component: () => import('@/views1/test/sale/sale-order-detail'),
            name: 'sale-order-detail',
            hidden: true,
            meta: { title: '销售订单-详情', icon: 'dashboard' }
          }
        ]
      },
      // purchase
      {
        path: '/purchase-root',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'purchase-root',
        meta: {
          title: '采购管理',
          icon: 'dashboard',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },

        children: [
          {
            path: 'purchase-order',
            component: () => import('@/views1/test/purchase/purchase-order'),
            name: 'purchase-order',
            meta: { title: '采购订单', icon: 'dashboard' }
          },
          {
            path: 'purchase-order-detail',
            component: () =>
              import('@/views1/test/purchase/purchase-order-detail'),
            name: 'purchase-order-detail',
            hidden: true,
            meta: { title: '采购订单-详情', icon: 'dashboard' }
          }
        ]
      },

      // account
      {
        path: '/account-root',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'account-root',
        meta: {
          title: '财务管理',
          icon: 'dashboard',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },

        children: [
          {
            path: 'account-invoice-out',
            component: () => import('@/views1/test/account/invoice-out'),
            name: 'account-invoice-out',
            meta: { title: '销售票据', icon: 'dashboard' }
          },
          {
            path: 'account-invoice-out-detail',
            component: () => import('@/views1/test/account/invoice-out-detail'),
            name: 'account-invoice-out-detail',
            hidden: true,
            meta: { title: '销售票据-详情', icon: 'dashboard' }
          },
          {
            path: 'account-payment-in',
            component: () => import('@/views1/test/account/payment-in'),
            name: 'account-payment-in',
            meta: { title: '销售收款单', icon: 'dashboard' }
          },
          {
            path: 'account-payment-in-detail',
            component: () => import('@/views1/test/account/payment-in-detail'),
            name: 'account-payment-in-detail',
            hidden: true,
            meta: { title: '销售收款单-详情', icon: 'dashboard' }
          }
        ]
      },

      // account-report
      {
        path: '/account-report-root',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'account-report-root',
        meta: {
          title: '财务报表',
          icon: 'dashboard',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },

        children: [
          {
            path: 'report_general_ledger',
            component: () =>
              import('@/views1/test/account/report/report_general_ledger'),
            name: 'report_general_ledger',
            meta: { title: '总账', icon: 'dashboard' }
          },
          {
            path: 'report_partnerledger',
            component: () =>
              import('@/views1/test/account/report/report_partnerledger'),
            name: 'report_partnerledger',
            meta: { title: '应收应付明细账', icon: 'dashboard' }
          },
          {
            path: 'report_trialbalance',
            component: () =>
              import('@/views1/test/account/report/report_trialbalance'),
            name: 'report_trialbalance',
            meta: { title: '试算平衡', icon: 'dashboard' }
          },
          {
            path: 'report_financial_bs',
            component: () =>
              import('@/views1/test/account/report/report_financial_bs'),
            name: 'report_financial_bs',
            meta: { title: '资产负债表', icon: 'dashboard' }
          },
          {
            path: 'report_financial_pl',
            component: () =>
              import('@/views1/test/account/report/report_financial_pl'),
            name: 'report_financial_pl',
            meta: { title: '损益表', icon: 'dashboard' }
          }
        ]
      },

      // hr
      {
        path: '/hr',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'hr',
        meta: {
          title: 'HR',
          icon: 'dashboard',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },

        children: [
          {
            path: 'hr-department',
            component: () => import('@/views1/test/hr/hr-department'),
            name: 'hr-department',
            meta: { title: '部门', icon: 'dashboard' }
          },
          {
            path: 'hr-department-detail',
            component: () => import('@/views1/test/hr/hr-department-detail'),
            name: 'hr-department-detail',
            hidden: true,
            meta: { title: '部门-详情', icon: 'dashboard' }
          },
          {
            path: 'hr-employee',
            component: () => import('@/views1/test/hr/hr-employee'),
            name: 'hr-employee',
            meta: { title: '员工', icon: 'dashboard' }
          },
          {
            path: 'hr-employee-detail',
            component: () => import('@/views1/test/hr/hr-employee-detail'),
            name: 'hr-employee-detail',
            hidden: true,
            meta: { title: '员工-详情', icon: 'dashboard' }
          }
          // {
          //   path: 'job',
          //   component: () => import('@/views1/hr/hr-job'),
          //   name: 'job',
          //   meta: { title: '职位', icon: 'ss_job' }
          // },
        ]
      },

      // hr expense
      {
        path: '/hr-expense-root',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'hr-expense-root',
        meta: {
          title: '费用管理',
          icon: 'dashboard',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },

        children: [
          {
            path: 'product-product-expense',
            component: () => import('@/views1/test/hr/product-product-expense'),
            name: 'product-product-expense',
            meta: { title: '费用项', icon: 'dashboard' }
          },
          {
            path: 'hr-expense-sheet',
            component: () => import('@/views1/test/hr/hr-expense-sheet'),
            name: 'hr-expense-sheet',
            meta: { title: '费用单', icon: 'dashboard' }
          },
          {
            path: 'hr-expense-sheet-detail',
            component: () => import('@/views1/test/hr/hr-expense-sheet-detail'),
            name: 'hr-expense-sheet-detail',
            hidden: true,
            meta: { title: '费用单-详情', icon: 'dashboard' }
          }
        ]
      }
    ]
  },

  // me
  {
    path: '/user-me',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'user-me',
    // hidden: true,
    meta: {
      title: '个人信息',
      icon: 'people',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      {
        path: 'res-users-me',
        component: () => import('@/views1/test/res/res-users-me'),
        name: 'res-users-me',
        // hidden: true,
        meta: { title: '登录信息', icon: 'dashboard' }
      },
      {
        path: 'changeUser',
        component: () => import('@/views1/user/userInfo'),
        name: 'promise',
        // hidden: true,
        meta: { title: '修改密码', icon: 'dashboard' }
      }
    ]
  },

  // for dict
  {
    path: '/dict',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'Dict',
    // hidden: true,
    meta: {
      title: 'Dict',
      icon: 'peoples',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      {
        path: 'word',
        component: () => import('@/views1/dictionary/dict-word'),
        name: 'word',
        // hidden: true,
        meta: { title: 'Word', icon: 'dashboard' }
      },
      {
        path: 'meaning',
        component: () => import('@/views1/dictionary/dict-meaning'),
        name: 'meaning',
        // hidden: true,
        meta: { title: 'Meaning', icon: 'dashboard' }
      },
      {
        path: 'learning',
        component: () => import('@/views1/dictionary/dict-learning'),
        name: 'learning',
        // hidden: true,
        meta: { title: 'learning', icon: 'dashboard' }
      }
    ]
  },

  // for dict app
  {
    path: '/dictapp',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'DictApp',
    // hidden: true,
    meta: {
      title: 'DictApp',
      icon: 'peoples',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      {
        path: 'learning',
        component: () => import('@/views1/dictapp/dict-app-learning'),
        name: 'learning',
        // hidden: true,
        meta: { title: 'learning', icon: 'dashboard' }
      }
    ]
  },

  // for soil
  {
    path: '/soil',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'soil',
    hidden: true,
    meta: {
      title: '土壤检测',
      icon: 'international',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      {
        path: 'soil-product',
        component: () => import('@/views1/soil/soil-product'),
        name: 'soil-product',
        meta: { title: '公司设备信息', icon: 'peoples' }
      },
      {
        path: 'soil-customer',
        component: () => import('@/views1/soil/soil-customer'),
        name: 'soil-customer',
        meta: { title: '农户信息', icon: 'peoples' }
      },
      {
        path: 'soil-test',
        component: () => import('@/views1/soil/soil-test'),
        name: 'soil-test',
        meta: { title: '检测数据录入', icon: 'eye-open' }
      },
      {
        path: 'soil-test-detail',
        component: () => import('@/views1/soil/soil-test-detail'),
        name: 'soil-test-detail',
        hidden: true,
        meta: { title: '检测数据-详情', icon: 'dashboard' }
      },
      {
        path: 'soil-test-line',
        component: () => import('@/views1/soil/soil-test-line'),
        name: 'soil-test-line',
        meta: { title: '检测报表', icon: 'chart' }
      }
    ]
  },

  // for caiwu, account agent , delivery and hr.expense
  {
    path: '/account-agent',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'account-agent',
    hidden: true,
    meta: {
      title: '财务公司服务平台',
      icon: 'international',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      // saas 管理
      {
        path: 'saas',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'saas',
        meta: {
          title: 'SaaS平台管理页面',
          icon: 'peoples',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },
        children: [
          {
            path: 'ems-res-company',
            component: () => import('@/views1/ems/res-company'),
            name: 'ems-res-company',
            meta: { title: '公司', icon: 'dashboard' }
          },
          {
            path: 'ems-res-company-detail',
            component: () => import('@/views1/ems/res-company-detail'),
            name: 'ems-res-company-detail',
            hidden: true,
            meta: { title: '公司-详情', icon: 'dashboard' }
          }
        ]
      },

      // agent 管理
      {
        path: 'agent',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'agent',
        meta: {
          title: '财务公司页面',
          icon: 'peoples',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },
        children: [
          {
            path: 'ems-comp-index',
            component: () => import('@/views1/ems/comp-index'),
            name: 'ems-comp-index',
            meta: { title: '说明', icon: 'dashboard' }
          },

          // deliver
          {
            path: 'deliver',
            component: () => import('@/views1/home/space'),
            alwaysShow: true, // will always show the root menu
            name: 'deliver',
            meta: {
              title: '收发快递',
              icon: 'peoples',
              roles: ['admin', 'editor'] // you can set roles in root nav
            },
            children: [
              {
                path: 'ems-customer',
                component: () => import('@/views1/ems/ems-customer'),
                name: 'ems-customer',
                meta: { title: '客户', icon: 'dashboard' }
              },
              {
                path: 'ems-customer-detail',
                component: () => import('@/views1/ems/ems-customer-detail'),
                name: 'ems-customer-detail',
                hidden: true,
                meta: { title: '客户-详情', icon: 'dashboard' }
              },
              {
                path: 'ems-order-out-comp',
                component: () => import('@/views1/ems/ems-order-out-comp'),
                name: 'ems-order-out-comp',
                meta: { title: '发快递', icon: 'dashboard' }
              },
              {
                path: 'ems-order-out-comp-detail',
                component: () =>
                  import('@/views1/ems/ems-order-out-comp-detail'),
                name: 'ems-order-out-comp-detail',
                hidden: true,
                meta: { title: '发快递-详情', icon: 'dashboard' }
              },
              {
                path: 'ems-order-in-comp',
                component: () => import('@/views1/ems/ems-order-in-comp'),
                name: 'ems-order-in-comp',
                meta: { title: '收快递', icon: 'dashboard' }
              },
              {
                path: 'ems-order-in-comp-detail',
                component: () =>
                  import('@/views1/ems/ems-order-in-comp-detail'),
                name: 'ems-order-in-comp-detail',
                hidden: true,
                meta: { title: '收快递-详情', icon: 'dashboard' }
              }
            ]
          },

          // hr
          {
            path: 'ems-hr',
            component: () => import('@/views1/home/space'),
            alwaysShow: true, // will always show the root menu
            name: 'ems-hr',
            meta: {
              title: 'HR',
              icon: 'dashboard',
              roles: ['admin', 'editor'] // you can set roles in root nav
            },

            children: [
              {
                path: 'ems-hr-department',
                component: () => import('@/views1/ems/hr-department'),
                name: 'ems-hr-department',
                meta: { title: '部门', icon: 'dashboard' }
              },
              {
                path: 'ems-hr-department-detail',
                component: () => import('@/views1/ems/hr-department-detail'),
                name: 'ems-hr-department-detail',
                hidden: true,
                meta: { title: '部门-详情', icon: 'dashboard' }
              },
              {
                path: 'ems-hr-employee',
                component: () => import('@/views1/ems/hr-employee'),
                name: 'ems-hr-employee',
                meta: { title: '员工', icon: 'dashboard' }
              },
              {
                path: 'ems-hr-employee-detail',
                component: () => import('@/views1/ems/hr-employee-detail'),
                name: 'ems-hr-employee-detail',
                hidden: true,
                meta: { title: '员工-详情', icon: 'dashboard' }
              },
              {
                path: 'ems-hr-job',
                component: () => import('@/views1/ems/hr-job'),
                name: 'ems-hr-job',
                meta: { title: '职位', icon: 'dashboard' }
              }
            ]
          },

          // hr expense
          {
            path: '/ems-hr-expense-root',
            component: () => import('@/views1/home/space'),
            alwaysShow: true, // will always show the root menu
            name: 'ems-hr-expense-root',
            meta: {
              title: '费用管理',
              icon: 'dashboard',
              roles: ['admin', 'editor'] // you can set roles in root nav
            },

            children: [
              {
                path: 'ems-product-product-expense',
                component: () => import('@/views1/ems/product-product-expense'),
                name: 'ems-product-product-expense',
                meta: { title: '费用项', icon: 'dashboard' }
              },
              {
                path: 'ems-hr-expense-sheet',
                component: () => import('@/views1/ems/hr-expense-sheet'),
                name: 'ems-hr-expense-sheet',
                meta: { title: '费用单', icon: 'dashboard' }
              },
              {
                path: 'ems-hr-expense-sheet-detail',
                component: () => import('@/views1/ems/hr-expense-sheet-detail'),
                name: 'ems-hr-expense-sheet-detail',
                hidden: true,
                meta: { title: '费用单-详情', icon: 'dashboard' }
              }
            ]
          }
        ]
      },

      // 财务公司的客户 收发快递
      {
        path: 'cust',
        component: () => import('@/views1/home/space'),
        alwaysShow: true, // will always show the root menu
        name: 'cust',
        meta: {
          title: '财务公司客户的页面',
          icon: 'dashboard',
          roles: ['admin', 'editor'] // you can set roles in root nav
        },
        // hidden: true,

        children: [
          {
            path: 'ems-order-out-cust',
            component: () => import('@/views1/ems/ems-order-out-cust'),
            name: 'ems-order-out-cust',
            meta: { title: '收快递', icon: 'dashboard' }
          },
          {
            path: 'ems-order-out-cust-detail',
            component: () => import('@/views1/ems/ems-order-out-cust-detail'),
            name: 'ems-order-out-cust-detail',
            hidden: true,
            meta: { title: '收快递-详情', icon: 'dashboard' }
          },
          {
            path: 'ems-order-in-cust',
            component: () => import('@/views1/ems/ems-order-in-cust'),
            name: 'ems-order-in-cust',
            meta: { title: '发快递', icon: 'dashboard' }
          },
          {
            path: 'ems-order-in-cust-detail',
            component: () => import('@/views1/ems/ems-order-in-cust-detail'),
            name: 'ems-order-in-cust-detail',
            hidden: true,
            meta: { title: '发快递-详情', icon: 'dashboard' }
          }
        ]
      }
    ]
  },

  // for edu-safety
  {
    path: '/edu-safety',
    component: Layout,
    alwaysShow: true, // will always show the root menu
    name: 'edu-safety',
    hidden: true,
    meta: {
      title: '学校安全预警平台',
      icon: 'international',
      roles: ['admin', 'editor'] // you can set roles in root nav
    },
    children: [
      {
        path: 'edu-dashboard',
        component: () => import('@/views1/edu/edu-dashboard'),
        name: 'edu-dashboard',
        meta: { title: '预警仪表盘', icon: 'chart' }
      },
      {
        path: 'edu-safety-point',
        component: () => import('@/views1/edu/edu-safety-point'),
        name: 'edu-safety-point',
        meta: { title: '风险控制点', icon: 'eye-open' }
      }
    ]
  }
]

const createRouter = () =>
  new Router({
    // mode: 'history', // require service support
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
  })

const router = createRouter()

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
  const newRouter = createRouter()
  router.matcher = newRouter.matcher // reset router
}

export default router
